
import React ,{Component} from "react";
import InputBox from "./components/InputBox";
import TodoBoard from "./components/TodoBoard";

class App extends Component{
  constructor(props){
    super(props)
      this.state={
        todo:{}
      }
    }
    // 定义回调函数
    addTodo = (todo)=>{
     console.log(todo);
    //  修改状态只能使用setatate函数
    this.setState({
      todo:todo
    })     
    }
  
  render(){
    return(
      <div className="App">
        <InputBox addTodo={this.addTodo}/>
        <TodoBoard todo={this.state.todo}/>
      </div>
    )
  }
}

export default App;
